home *** CD-ROM | disk | FTP | other *** search
Text File | 1990-06-24 | 37.7 KB | 941 lines | [TEXT/pdos] |
- *******************************************************************************
- *
- * Jiffy Windows - Pixel Transfer Demonstration
- *
- * (C) Copyright Apple Computer, Inc. 1988-1990
- * All rights reserved.
- *
- * Developer Technical Support Apple II Sample Code
- *
- * by Keith Rollin
- *
- * This program shows the use of PPToPort and OffScreen GrafPorts in
- * the implementation of a window content caching system. It presents 5 "Test"
- * windows and a large window full of text to show the effects of this caching.
- *
- * Caching is setup at the time the window is created and performed the first
- * time the window needs to be updated (drawn). Before the window is created,
- * a routine (AddCacheRecord) is called to create a "Cache Record". The handle
- * to this cache record is stored in the window's RefCon, and contains infor-
- * mation on the offscreen image. When it comes time to draw to the screen, this
- * record is examined to see if there is any information buffered already. If
- * not, then drawing occurs to the offscreen buffer. After an offscreen image
- * has been made, updates are performed by calling PPToPort to copy the image
- * from the offscreen buffer to the screen. If, for any reason, an offscreen
- * buffer cannot be made, drawing occurs to the window directly.
- *
- * An effort has been made to make this caching as transparent as possible.
- * Windows act normally, and the routines that update them in a normal envi-
- * ronment can be used in this buffered environment. The caching routine is
- * inserted in between TaskMaster and the update routine, and calls the update
- * routine almost as if it were called by TaskMaster. The only difference is
- * that the routine is drawing to an offscreen GrafPort, and not a Window
- * record.
- *
- * A change was made to work around a bug in fastFont on system disk 5.0. A
- * routine called xorPoint was added. This takes care of the bug.
- *
- *******************************************************************************
- eject
-
- **********************************************************************
- * *
- * Apple IIGS Source Code Sampler, Volume I *
- * *
- * Copyright (c) Apple Computer, Inc. 1988-1990 *
- * All Rights Reserved *
- * *
- * Written by Apple II Developer Tech Support *
- * *
- * *
- * *
- * ---------------------------------------------------------------- *
- * *
- * This program and its derivatives are licensed only for *
- * use on Apple computers. *
- * *
- * Works based on this program must contain and *
- * conspicuously display this notice. *
- * *
- * This software is provided for your evaluation and to *
- * assist you in developing software for the Apple IIGS *
- * computer. *
- * *
- * DISCLAIMER OF WARRANTY *
- * *
- * THE SOFTWARE IS PROVIDED "AS IS" WITHOUT *
- * WARRANTY OF ANY KIND, EITHER EXPRESS OR IMPLIED, *
- * WITH RESPECT TO ITS MERCHANTABILITY OR ITS FITNESS *
- * FOR ANY PARTICULAR PURPOSE. THE ENTIRE RISK AS TO *
- * THE QUALITY AND PERFORMANCE OF THE SOFTWARE IS WITH *
- * YOU. SHOULD THE SOFTWARE PROVE DEFECTIVE, YOU (AND *
- * NOT APPLE OR AN APPLE AUTHORIZED REPRESENTATIVE) *
- * ASSUME THE ENTIRE COST OF ALL NECESSARY SERVICING, *
- * REPAIR OR CORRECTION. *
- * *
- * Apple does not warrant that the functions *
- * contained in the Software will meet your requirements *
- * or that the operation of the Software will be *
- * uninterrupted or error free or that defects in the *
- * Software will be corrected. *
- * *
- * SOME STATES DO NOT ALLOW THE EXCLUSION *
- * OF IMPLIED WARRANTIES, SO THE ABOVE EXCLUSION MAY *
- * NOT APPLY TO YOU. THIS WARRANTY GIVES YOU SPECIFIC *
- * LEGAL RIGHTS AND YOU MAY ALSO HAVE OTHER RIGHTS *
- * WHICH VARY FROM STATE TO STATE. *
- * *
- * *
- **********************************************************************
- eject
-
- case on
-
-
- copy 2/ainclude/E16.Quickdraw
- copy 2/ainclude/E16.Memory
- copy 2/ainclude/E16.EVENT
- copy 2/ainclude/E16.Window
- copy 2/ainclude/E16.Dialog
- mcopy macros/jiffy.macros
-
- *******************************************************************************
- *
- * Equates used in this program.
- *
- *******************************************************************************
- DPHandle gequ 0 ; Handle to Tool Direct Page area
- DPPointer gequ DPHandle+4 ; Pointer to Tool Direct Page area
- Deref gequ DPPointer+4 ; Temporary Handle dereference area
- CPPtr gequ Deref+4 ; pointer to current caching parms
- temp1 gequ CPPtr+4 ; temp pointer
- temp2 gequ temp1+4 ; temp pointer
-
- ScreenMode gequ mode640
- ScreenWidth gequ 640
-
- CacheRecordSize gequ 12
-
- EJECT
- *******************************************************************************
- *
- Main start
- *
- * Description: This is the main routine. It calls routines to Initialize
- * the tools, initialize application specific data, run the
- * main EventLoop, close the application, and close the tools.
- * Then it calls the ProDOS Quit command.
- *
- *
- * Inputs: NONE
- *
- * Outputs: NONE
- *
- * External Refs:
- * Import InitTools
- * Import InitApp
- * Import EventLoop
- * Import CloseApp
- * Import CloseTools
- * Import QuitParms
- *
- * Entry Points: NONE
- *
- *******************************************************************************
-
- jsr InitTools
- jsr InitApp
-
- _ShowCursor
-
- jsr EventLoop
-
- jsr CloseApp
- jsr CloseTools
-
- _Quit QuitParms
-
- end
-
- EJECT
- *******************************************************************************
- *
- Globals data
- *
- * Description: Holder of all of our data.
- *
- *
- * Inputs: N/A
- *
- * Outputs: N/A
- *
- * External Refs:
- * Import DrawOdyRtn
- * Import CacheContent
- * Import DrawContent
- *
- * Entry Points:
- * Export QuitParms ; used by Main
- *
- *******************************************************************************
- *
- * Standard global data
- *
- *******************************************************************************
-
- TitleString str 'Jiffy Windows'
- AutString str 'By Keith Rollin, Apple II DTS'
- CopyString str 'Copyright (c) 1988-1990 Apple Computer'
- VerString str 'Version 3.0 June 19, 1990'
- AboutData dc c'73/*0',i1'13',c'*1',i1'13',c'*2',i1'13',c'*3/^#0',i1'0'
- SubStrings dc i4'TitleString,AutString,CopyString,VerString'
-
- MenuHeight ds 2 ; Stored height of menu bar
- MyID ds 2 ; Application ID
- MyDP ds 2 ; My direct page storage
-
- QuitFlag ds 2
- QuitParms dc i4'0' ; Pathname of next app
- dc i2'$00' ; flags
-
- EventRecord ANOP
- EventWhat ds 2
- EventMessage ds 4
- EventWhen ds 4
- EventWhere ds 4
- EventModifiers ds 2
- TaskData ds 4
- TaskMask dc i4'$0000FFFF'
-
- EJECT
- *******************************************************************************
- *
- * Application specific global data
- *
- *******************************************************************************
-
- ; This is a list of pointers to the text that is used to create our menus. It
- ; is used by InitApp to find all of the menu templates and use them to create
- ; our menubar. This loop loads MenuPtrLen-4 into an index, gets the
- ; corresponding menu template pointer in this table, and uses that in a
- ; NewMenu call. It then decrements the index by 4, and repeats the procees
- ; until the index is negative.
-
- MenuPtr dc i4'AppMenu'
- dc i4'FileMenu'
- dc i4'EditMenu'
- MenuPtrLen equ *-MenuPtr
-
-
- ; Menu list: menu items should be numbered consecutivly starting from 250.
- ; As a convention, use 256 as about and 257 as Quit.
-
- AppMenu dc c'$$@\XN1',h'0D'
- dc c'--About Jiffy Windows...\N256V',i1'0'
- dc c'.'
- FileMenu dc c'$$ File \N2',i1'0'
- dc c'--Open Test Windows\N258',i1'0'
- dc c'--Read a book\N259',i1'0'
- dc c'--Close\N255DV',i1'0'
- dc c'--Quit\N257*Qq',i1'0'
- dc c'.'
- EditMenu dc c'$$ Edit \N3',i1'0'
- dc c'--Undo\N250*ZzVD',i1'0'
- dc c'--Cut\N251*XxD',i1'0'
- dc c'--Copy\N252*CcD',i1'0'
- dc c'--Paste\N253*VvD',i1'0'
- dc c'--Clear\N254D',i1'0'
- dc c'.'
-
- wPtr1 dc i4'0'
- wPtr2 dc i4'0'
- wPtr3 dc i4'0'
- wPtr4 dc i4'0'
- wPtr5 dc i4'0'
- OdyWindow dc i4'0'
-
- WindowTitle1 str ' Window 1 (not Cached) '
- WindowTitle2 str ' Window 2 (not Cached) '
- WindowTitle3 str ' Window 3 (Cached) '
- WindowTitle4 str ' Window 4 (Cached) '
- WindowTitle5 str ' Window 5 (Cached) '
-
- wtPtrs dc i4'WindowTitle1,WindowTitle2'
- dc i4'WindowTitle3,WindowTitle4'
- dc i4'WindowTitle5'
-
- Stripes ANOP
- dc i2'$0000' ; Black frame
- dc i2'$0f00' ; Inact TBcolor, Inact TColor, Tcolor
- dc i2'$020f' ; Pattern, Pattern color, BG color
- dc i2'$0000' ; Frame growbox unselcted/selected
- dc i2'$00f0' ; infobar color (white)
-
- MWindData dc i2'MWEnd-MWindData'
- dc i2'fTitle+fClose+fMove'
- WindowTitle dc i4'0' ; Ptr to title
- dc i4'0' ; RefCon
- dc i2'0,0,0,0' ; Full Size (0= default)
- dc i4'Stripes' ; Color Table Pointer
- dc i2'0,0' ; Vertical/Horizontal origin
- dc i2'0,0' ; Data area height, width
- dc i2'0,0' ; Max Cont height, width
- dc i2'0,0' ; Pixels to scroll vert'ly, horiz'ly
- dc i2'0,0' ; Pixels to page vert'ly, horiz'ly
- dc i4'0' ; Information bar refcon.
- dc i2'0' ; Info bar height
- dc i4'0' ; DefProc.
- dc i4'0' ; Routine to draw info. bar.
- ContDraw dc i4'CacheContent' ; Routine to cache/draw content.
- wPosition dc i2'10,40,120,400' ; Size and position
- dc i4'$FFFFFFFF' ; Plane to put window up in (bottommost).
- dc i4'0' ; Address for window record (0 to alloc)
- MWEnd ANOP
- ;
- ; These parms MUST follow immediately after the window record
- ;
- MWCacheParms dc i4'DrawContent-1' ; real draw routine
- dc i4'0' ; space for caching handle
- dc i2'110,360' ; Height, width
-
-
- OdyTitle str ' Odyssey '
- OdyWindData dc i2'OdyEnd-OdyWindData'
- dc i2'fTitle+fClose+fMove+fRScroll+fBScroll+fGrow'
- dc i4'OdyTitle' ; Ptr to title
- dc i4'0' ; RefCon
- dc i2'0,0,0,0' ; Full Size (0= default)
- dc i4'Stripes' ; Color Table Pointer
- dc i2'0,0' ; Vertical/Horizontal origin
- dc i2'797,600' ; Data area height, width
- dc i2'0,0' ; Max Cont height, width
- dc i2'32,32' ; Pixels to scroll vert'ly, horiz'ly
- dc i2'0,0' ; Pixels to page vert'ly, horiz'ly
- dc i4'0' ; Information bar refcon.
- dc i2'0' ; Info bar height
- dc i4'0' ; DefProc.
- dc i4'0' ; Routine to draw info. bar.
- dc i4'CacheContent' ; Routine to cache/draw content.
- dc i2'30,5,185,605' ; Size and position
- dc i4'$FFFFFFFF' ; Plane to put window up in (bottommost).
- dc i4'0' ; Address for window record (0 to alloc)
- OdyEnd ANOP
- ;
- ; These parms MUST follow immediately after the window record
- ;
- OdyCacheParms dc i4'DrawOdyRtn-1'
- dc i4'0' ; space for caching handle
- dc i2'792,640' ; Height, width
-
- Odyssey ANOP
- dc i1'13,13'
- dc i1'1',c'J',i1'1,0'
- dc i1'1',c'F',i1'0,0,0,16' ; Shaston 16
- dc c'1',i1'13'
- dc c'Boot Camp',i1'13'
- dc i1'1',c'J',i1'2,0'
- dc i1'1',c'F',i1'0,0,0,8' ; Shaston 8
- dc i1'13,13'
- dc c' At Pepsi, we lived for the smallest details.'
- dc i1'13,13'
- dc c' The moment I entered the boardroom, I knew the '
- dc c'meeting would be momentous. For years, these '
- dc c'executive sessions had followed a carefully '
- dc c'orchestrated ritual. Today, there was a subtle, '
- dc c'though telling, difference.',i1'13,13'
-
- dc c' Ordinarily, the conference table''s 21-foot-'
- dc c'long surface, polished to look more like glass than '
- dc c'the rare burl of Carpathian elm, would be touched '
- dc c'only by PepsiCo board members, and then no more '
- dc c'than twelve times a year. Today, the fitted leather '
- dc c'covering that hid the gleaming top was removed.'
- dc i1'13,13'
-
- dc c' I had been in this room at least a hundred '
- dc c'times. I had sat worried at this table and I had '
- dc c'nearly soared at it. I had witnessed tense '
- dc c'colleagues - friends - being publicly hung for '
- dc c'questions of performance, and I had seen them '
- dc c'applauded, just as I had been here, for marketing '
- dc c'ideas and strategies.',i1'13,13'
-
- dc c' But this meeting was different. The table''s '
- dc c'exposed top said so. It made the spacious, '
- dc c'windowless room all the more imposing. Like nearly '
- dc c'everything else at PepsiCo, Inc., the room''s '
- dc c'stately power and elegance made you stand a little '
- dc c'straighter. A large abstact painting by Jackson '
- dc c'Pollock''s widow, Lee Krasner, dominated the far '
- dc c'wall. Custom-designed carpeting in earth-tone '
- dc c'colors cushioned the floor. The bronze-plated '
- dc c'ceiling, perhaps more appropriate for a church, '
- dc c'reflected burnished mahogany-paneled walls. High-'
- dc c'backed beige leather chairs, so imposing they could '
- dc c'have carried corporate titles of their own, '
- dc c'surrounded the boardroom table.',i1'13,13'
-
- dc c' Every two months the marketing gurus of Pepsi '
- dc c'-- the company''s heart and soul -- would gather '
- dc c'here, on 4/3, the executive floor of PepsiCo''s '
- dc c'corporate headquarters in the New York City suburb '
- dc c'of Purchase, for a private ritual in the public war '
- dc c'on the colas between Pepsi and Coke. A. C. Neilsen '
- dc c'Co., the country''s most prestigious market-'
- dc c'research firm, would formally present what became '
- dc c'popularly known as the Nielsens -- closely guarded '
- dc c'market-share figures that showed how we were faring '
- dc c'in our competitive battle with Coca-Cola Co. The '
- dc c'Nielsens defined the ground rules of competition '
- dc c'for everyone at Pepsi. They were at the epicenter '
- dc c'of all we did. They were the non-public body counts '
- dc c'of the Cola Wars.',i1'13,13'
-
- dc c' Like the other meetings, this one was a '
- dc c'ceremonial event. We marked it on our calendars '
- dc c'many weeks in advance. Everyone wore the unofficial '
- dc c'corporate uniform: a blue pin-striped suit, white '
- dc c'shirt, and a sincere red tie. None of us would ever '
- dc c'remove his jacket. We dressed and acted as if we '
- dc c'were at a meeting of the board of directors.',i1'13,13'
-
- dc c' The Nielsen executives were the first to '
- dc c'arrive. They carried themselves like accountants -- '
- dc c'good presenters with bland personalities in blue '
- dc c'and gray suits. They were followed by Pepsi''s '
- dc c'junior executives, the support staff of market '
- dc c'researchers and brand managers who could provide a '
- dc c'stray fact or figure for the division officers and '
- dc c'vice presidents who filed into the room next.'
- dc i1'13,13'
-
- dc c' Everyone in this room was on the fast track, '
- dc c'which at Pepsi was more like a racecourse. The '
- dc c'senior officers here were the best of the best. In '
- dc c'a corporation populated with bright, ambitious '
- dc c'achievers, they were peerless. They had proven they '
- dc c'were intellectually and physically fit supervisors '
- dc c'in America''s corporate Marine Corps.',i1'13,13'
-
- dc c' As president of Pepsi-Cola, I entered the room '
- dc c'next. Corporate formality dictated where all of us '
- dc c'sat. The company''s top officers gravitated to the '
- dc c'front of the table, the junior execs toward the '
- dc c'back. Staff people found chairs away from the table '
- dc c'along the walls. When everyone was in place, I went '
- dc c'across the hall to alert PepsiCo''s president, '
- dc c'Andrall E. Pearson, who then joined us.',i1'13,13'
-
- dc c' Everyone chatted away until the heavy wooden '
- dc c'doors opened once again. The room fell quiet as a '
- dc c'big-boned man with a frizzy shock of white hair '
- dc c'strode in. PepsiCo chairman and chief executive '
- dc c'Donald M. Kendall, fifty-seven, was no taller than '
- dc c'six feet one, but he was a man of enormous '
- dc c'presence, respected and feared by colleagues. '
- dc c'Today, Kendall was feeling great pleasure. He '
- dc c'worked the room like a politician, gripping hands, '
- dc c'slapping backs, and giving an occasional bear hug '
- dc c'-- a patented gesture of strength and affection '
- dc c'that Kendall reserved for only a few.',i1'13,13'
- dc c'From Odyssey by John Sculley',i1'13'
- dc c'Used by Permission, Harper & Row, Publishers, Inc.'
- dc i1'13,13'
- OdysseyEnd ANOP
- end
-
- EJECT
- *******************************************************************************
- *
- InitApp start
- *
- * Description: Perform any application specific initialization.
- *
- * Inputs: NONE
- *
- * Outputs: NONE
- *
- * External Refs:
- * Import SlowDraw
- *
- * Entry Points: NONE
- *
- *******************************************************************************
- using Globals
-
- stz QuitFlag
-
- ;
- ; Create 5 test windows. Loop from 4 to 0, calling AddWindow with
- ; the loop index in the accumulator. AddWindow will use this index
- ; to name the window, determine if it should be cached or not, and
- ; stagger its position.
- ;
-
- lda #4
- sta Windex
- loop lda Windex
- jsr AddWindow
- dec Windex
- bpl loop
-
-
- ;
- ; Create the window to hold John "The Dude" Sculley's book.
- ;
- lda #OdyWindData ; create a cache record for it
- ldx #^OdyWindData
- jsr AddCacheRecord
-
- pha
- pha
- PushLong #OdyWindData
- _NewWindow
- PullLong OdyWindow
-
- rts
-
- Windex ds 2
-
- ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;
- ;
- ; Enter this routine with an index from 0 to 4. This index is
- ; used to set the window's title from a list of titles, stagger
- ; its position and to determine whether or not it should be cached.
- ;
-
- AddWindow ANOP
-
- ;
- ; Turn the window counter into an array index. This index is
- ; stored in X and is used throughout the routine, so I need
- ; to be sure not to destroy it!
- ;
- asl a
- asl a
- tax
- stx IndexSave
- ;
- ; Set up the pointer to the window's name
- ;
- lda wtPtrs,x
- sta WindowTitle
- lda wtPtrs+2,x
- sta WindowTitle+2
-
- ; Bump the window's position so as to stagger them
-
- ldy #6
- loop2 lda wPosition,y
- clc
- adc #20
- sta wPosition,y
- dey
- dey
- bpl loop2
-
- ; the last 2 windows are special...they don't get cached...
-
- cpx #4
- bne CreateIt
- lda #SlowDraw
- sta ContDraw
- lda #^SlowDraw
- sta ContDraw+2
-
- CreateIt ANOP
- lda #MWindData ; create a cache record for it
- ldx #^MWindData
- jsr AddCacheRecord
-
- pha
- pha
- PushLong #MWindData
- _NewWindow
-
- ldx IndexSave
- lda 1,s
- sta wPtr1,x ; now save our window pointer in our
- lda 3,s ; window pointer array.
- sta wPtr1+2,x
- ;
- ; the window pointer is still on the stack, so use it to
- ; set the current port (NewWindow doesn't do that!!!)
- ;
- _SetPort
-
- done ANOP
- rts
-
- IndexSave ds 2
-
- ;
- ; Just before creating a new window, we must create a cache record for it.
- ; This record will hold: a) the routine to draw the contents the first time,
- ; b) a pointer to the offscreen GrafPort, and c) the dimensions needed to
- ; create the GrafPort. This cache record is created from a template stored
- ; IMMEDIATELY after the window parameter list (after owStorage).
- ;
- ; Enter this routine with the pointer to the window parameter list in A,X.
- ;
- AddCacheRecord ANOP
- sta temp1
- stx temp1+2 ; temp1 now points to the parmlist
-
- clc ; make a pointer to the template
- adc #owStorage+4
- sta temp2
- stx temp2+2
-
- pha ; space for the new handle
- pha
- PushLong #CacheRecordSize
- PushWord MyID
- PushWord #attrNoCross
- PushLong #$0000
- _NewHandle
- PullLong myHandle ; handle to cache record in Deref
-
- PushLong temp2 ; copy the template over
- PushLong myHandle
- PushLong #CacheRecordSize
- _PtrToHand
-
- ldy #owRefCon ; set the RefCon to the handle
- lda myHandle
- sta [temp1],y
- iny
- iny
- lda myHandle+2
- sta [temp1],y
-
- rts
-
- myHandle ds 4
-
- end
-
- EJECT
- *******************************************************************************
- *
- CloseApp start
- *
- * Description: Close down things. This disposes of all items and memory
- * that we allocated.
- *
- *
- * Inputs: NONE
- *
- * Outputs: NONE
- *
- * External Refs: NONE
- *
- * Entry Points: NONE
- *
- *******************************************************************************
- using Globals
-
- ; Sly Trick #1!!! Traverse the window list, clearing the visible
- ; bit in each one. Then, when the window manager closes down, it
- ; will think that all windows are hidden, and it will NOT erase
- ; them from the screen. This makes quitting faster!
-
- pha ; get a pointer to the first
- pha ; window.
- _GetFirstWindow
- PullLong temp1
-
- loop ANOP
- pha ; get the window's bit flags
- PushLong temp1
- _GetWFrame
- pla
-
- and #$FFFF-fVis ; turn off the Vis Flag
-
- pha ; now send it back out
- PushLong temp1
- _SetWFrame
-
- pha ; get the next window in the
- pha ; list
- PushLong temp1
- _GetNextWindow
- PullLong temp1
-
- lda temp1 ; If NULL ($0000 0000) was returned
- bne loop ; then we are out to windows to
- lda temp1+2 ; fix.
- bne loop
-
- rts
- end
-
- EJECT
- *******************************************************************************
- *
- EventLoop start
- *
- * Description: Main Event Loop. Handle things until user selects Quit.
- *
- *
- * Inputs: NONE
- *
- * Outputs: NONE
- *
- * External Refs:
- * Import MenuSelect
- * Import Ignore
- * Import doUpdate
- * Import doClose
- *
- * Entry Points: NONE
- *
- *******************************************************************************
- using Globals
-
- pha ; Push on space for TaskMaster result
- PushWord #everyEvent ; GetNextEvent mask
- PushLong #EventRecord ; Pointer to Event Record
- _TaskMaster
-
- pla ; Get TaskMaster result
- beq EventLoop ; Remove if you want to use null events
- asl A ; Turn it into an index
- tax
- jsr (TaskTable,x) ; Call appropriate event handler
-
- lda QuitFlag ; Quit selected?
- beq EventLoop ; no - keep looping
-
- rts ; yes- leave the program
-
- TaskTable dc i2'Ignore' ; 0 Null
- dc i2'Ignore' ; 1 MouseDown
- dc i2'Ignore' ; 2 MouseUp
- dc i2'Ignore' ; 3 KeyDown
- dc i2'Ignore' ; 4 undefined
- dc i2'Ignore' ; 5 AutoKey
- dc i2'Ignore' ; 6 Update
- dc i2'Ignore' ; 7 undefined
- dc i2'Ignore' ; 8 Activate
- dc i2'Ignore' ; 9 Switch
- dc i2'Ignore' ; 10 Desk accessory
- dc i2'Ignore' ; 11 Device driver
- dc i2'Ignore' ; 12 ap
- dc i2'Ignore' ; 13 ap
- dc i2'Ignore' ; 14 ap
- dc i2'Ignore' ; 15 ap
- dc i2'Ignore' ; TASK 0 indesk
- dc i2'MenuSelect' ; TASK 1 in menuBar
- dc i2'Ignore' ; TASK 2 in system window
- dc i2'Ignore' ; TASK 3 in content
- dc i2'Ignore' ; TASK 4 in Drag
- dc i2'Ignore' ; TASK 5 in grow
- dc i2'doClose' ; TASK 6 in goaway
- dc i2'Ignore' ; TASK 7 in zoom
- dc i2'Ignore' ; TASK 8 in info bar
- dc i2'MenuSelect' ; TASK 9 in special menu
- dc i2'Ignore' ; TASK 10 in NDA
- dc i2'Ignore' ; TASK 11 in frame
- dc i2'Ignore' ; TASK 12 in drop
-
- end
-
- EJECT
- *******************************************************************************
- *
- MenuSelect start
- *
- * Description: This routine is called when TaskMaster returns a menu
- * event. It takes the menu item that was hit and calculates
- * an offset into the menu dispatch table. It then calls that
- * routine and unhilites the menu when it is done.
- *
- * Inputs: TaskData holds menu item selected.
- *
- * Outputs: NONE
- *
- * External Refs:
- * Import Ignore
- * Import doClose
- * Import doAbout
- * Import doQuit
- * Import doOpenTest
- * Import doShowOdy
- *
- * Entry Points: NONE
- *
- *******************************************************************************
- using Globals
-
- lda TaskData ; Get the ID of the menu item selected.
- sec ; Turn it into an index by subtracting
- sbc #250 ; the starting ID number (25) and mul-
- asl a ; tiplying by 2 (each table entry con-
- tax ; sists of 2 bytes).
- jsr (MenuTable,x) ; Call the routine behind it.
-
- PushWord #0 ; Routine done - unhilite the menubar.
- PushWord TaskData+2
- _HiLiteMenu
-
- rts
-
- MenuTable dc i2'Ignore' ; undo
- dc i2'Ignore' ; cut
- dc i2'Ignore' ; copy
- dc i2'Ignore' ; paste
- dc i2'Ignore' ; clear
- dc i2'doClose' ; close
- dc i2'doAbout'
- dc i2'doQuit'
- dc i2'doOpenTest' ; open 5 windows with stuff in them
- dc i2'doShowOdy' ; purge the refcons
- end
-
- EJECT
- *******************************************************************************
- *
- Ignore start
- *
- * Description: Called when I want to ignore an event.
- *
- *
- * Inputs: NONE
- *
- * Outputs: NONE
- *
- * External Refs: NONE
- *
- * Entry Points: NONE
- *
- *******************************************************************************
-
- rts
- end
-
- EJECT
- *******************************************************************************
- *
- doAbout start
- *
- * Description: Bring up an Alert Dialog box with our name in it. This
- * uses the new _AlertWindow call implemented in the Window
- * Manager on System Disk 3.2.
- *
- * Inputs: NONE
- *
- * Outputs: NONE
- *
- * External Refs: NONE
- *
- * Entry Points: NONE
- *
- *******************************************************************************
- using Globals
-
- pha ; space for result
- PushWord #1 ; we are using P-Strings
- PushLong #SubStrings
- PushLong #AboutData
- ldx #$590E ; _AlertWindow
- jsl $E10000
- pla ; pull off button hit
-
- rts
- end
-
- EJECT
- *******************************************************************************
- *
- doOpenTest start
- *
- * Description: Open the 5 test windows that we created in InitApp. It
- * merely loops through an array of 5 window pointers and
- * calls SelectWindow and ShowWindow for all of them. It then
- * disables the menu item that was used to call this routine
- * and enables the Close menu Item.
- *
- *
- * Inputs: NONE
- *
- * Outputs: NONE
- *
- * External Refs: NONE
- *
- * Entry Points: NONE
- *
- *******************************************************************************
- using Globals
-
- lda #4 ; we need to count through 5 windows
- loop ANOP
- pha ; save the counter on the stack
- asl a ; turn it into an index
- asl a
- tax
- lda wPtr1+2,x ; get a window pointer from my array
- tay ; of test windows.
- lda wPtr1,x
-
- phy ; push on window ptr for _SelectWindow
- pha
- phy ; push on window ptr for _ShowWindow
- pha
-
- _SelectWindow ; Bring the window to front
- _ShowWindow ; Make it visible
-
- pla ; get my counter back
- dec a ; loop down to the next window.
- bpl loop ; if >= 0 keep looping
-
- PushWord #258 ; Disable (Open Test Windows) item
- _DisableMItem
-
- PushWord #255 ; windows are open, enable close item
- _EnableMItem
-
- rts
- end
-
- EJECT
- *******************************************************************************
- *
- doShowOdy start
- *
- * Description: Show the window that displays the first few pages of John
- * Buddy's book. This routine Selects the window, and then
- * Shows it to make it visible. It finishes up by disabling
- * the Read a Book menu item and enabling the Close item.
- *
- *
- * Inputs: NONE
- *
- * Outputs: NONE
- *
- * External Refs: NONE
- *
- * Entry Points: NONE
- *
- *******************************************************************************
- using Globals
-
- PushLong OdyWindow
- _SelectWindow
-
- PushLong OdyWindow
- _ShowWindow
-
- PushWord #255 ; windows are open - enable close item
- _EnableMItem
-
- PushWord #259 ; Disable (Read Book) item
- _DisableMItem
-
- rts
- end
-
- copy jiffy.asm2
-